package biz.ezcom.spring.jdbc.po;

import java.util.Date;

public class User {
    private int    id;
    private int    roldId;
    private String username;
    private String password;
    private Date   birthday;

    public User() {
        super();
    }

    public User(int id, int roldId, String username, String password, Date birthday) {
        super();
        this.id = id;
        this.roldId = roldId;
        this.username = username;
        this.password = password;
        this.birthday = birthday;
    }

    public final int getId() {
        return this.id;
    }

    public final void setId(int id) {
        this.id = id;
    }

    public final int getRoldId() {
        return this.roldId;
    }

    public final void setRoldId(int roldId) {
        this.roldId = roldId;
    }

    public final String getUsername() {
        return this.username;
    }

    public final void setUsername(String username) {
        this.username = username;
    }

    public final String getPassword() {
        return this.password;
    }

    public final void setPassword(String password) {
        this.password = password;
    }

    public final Date getBirthday() {
        return this.birthday;
    }

    public final void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    @Override
    public int hashCode() {
        return this.toString().hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null || (obj.getClass() != this.getClass())) {
            return false;
        }
        User user = (User) obj;
        if (this.getId() != user.getId()) {
            return false;
        }
        if (this.getRoldId() != user.getRoldId()) {
            return false;
        }
        if (!this.getUsername().equals(user.getUsername())) {
            return false;
        }
        if (!this.getPassword().equals(user.getPassword())) {
            return false;
        }
        if (!this.getBirthday().equals(user.getBirthday())) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return this.getId() + " : " + this.getRoldId() + " : " + this.getUsername() + " : " + this.getPassword() + " : " + this.getBirthday();
    }
}
